<?php
use doumiaoduo\layer\LayerConfirmWidget;
use doumiaoduo\layer\LayerIframeWidget;
use yii\helpers\Html;
use common\components\helpers\Fun;
LayerConfirmWidget::widget();
LayerIframeWidget::widget();
?>
<div class="yx-praise-list-box yx-praise-box yx-radius2 zx-min-height">
    <!--/*添加按钮*/-->
    <?= $this->renderFile('@app/views/layouts/toolbar.php'); ?>
    <!--/*搜索*/-->
    <div id="search-area" class="yx-bgf7f7f7 yx-radius5 zx-mg yx-function2 yx-pr0">
        <?= Html::beginForm(Fun::url(['course/index']), 'get', ['enctype' => 'multipart/form-data']) ?>
        <?= \common\components\helpers\Search::textInput('category_name', null, ['label' => '分类名称', 'class' => 'search  yx-width150 zx-lh24 yx-ml6']); ?>
        <?= \common\components\helpers\Search::textInput('name', null, ['label' => '课程名称', 'class' => 'search  yx-width190 zx-lh24 yx-ml6']); ?>
        <?= \common\components\helpers\Search::textInput('mechanic_name', null, ['label' => '机构名称', 'class' => 'search yx-input-text zx-width190 yx-ml6']); ?>
        <?= \common\components\helpers\Search::dropDownList('teache_form', null, [null => '请选择', 1 => '小班制', 2 => '普通班', 0 => '一对一', 3 => '一对二', 4 => '一对三'], ['label' => '教学形式', 'promote' => '请选择', 'class' => 'search diy_select_txt']) ?>
        <?= \common\components\helpers\Search::submitButton('搜索', ['id' => 'search-handle', 'class' => "yx-search yx-radius2"]); ?>
        <?php Html::endForm() ?>
    </div>
    <!--/*表*/-->
    <div class="docs-main zx-mg">
        <table id="tablesaw" class="tablesaw table yx-table1 yx-table3 table-striped with-check"
               data-tablesaw-mode="swipe" data-tablesaw-minimap>
            <thead>
            <tr class="yx-bgd2f6ec">
                <th><?= \Yii::t('zhtfrontend', 'ID'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '分类名称'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '课程名'); ?></th>
                <th id="kh-sort-mechanic" class="DESC"><?= \Yii::t('zhtfrontend', '机构名称'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '创建时间'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '教学形式'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '操作员'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '修改时间'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '操作'); ?></th>
            </tr>
            </thead>
            <?php if ($data): ?>
                <?php foreach ($data as $item): ?>
                    <tr data-id="<?= $item['id'] ?>">
                        <td><?= $item['id'] ?></td>
                        <td><?= $item['category_name'] ?></td>
                        <td><?= $item['name'] ?></td>
                        <td><?= $item['mechanic_name'] ?></td>
                        <td><?= $item['created_at'] ?></td>
                        <td><?= $item['teache_form'] ?></td>
                        <td><?= $item['admin'] ?></td>
                        <td><?= $item['updated_at'] ?></td>
                        <td><?= $item['operate'] ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php endif; ?>
        </table>
        <div style="text-align: right"><?= common\components\widgets\GoPager::widget(['pagination' => $pages]) ?></div>
    </div>
</div>


<?php
$js = <<<JS
//排序用，暂时不用
//     $('#kh-sort-mechanic').click(function(){
//         var sort = $(this).attr('class');
//         $.ajax({  
//             url:'/course-index',
//             traditional :true,
//             data:{  
//                 sort : sort
//             },  
//             type:'post',  
//             cache:false,  
//             dataType:'json',  
//             success:function(data) {
//                 if(sort == 'DESC'){
//                     $('#kh-sort-mechanic').removeClass('DESC');
//                     $('#kh-sort-mechanic').addClass('ASC');
//                 }else{
//                     $('#kh-sort-mechanic').removeClass('ASC');
//                     $('#kh-sort-mechanic').addClass('DESC');
//                 }
//                
//             }
//         });
//     });
JS;
$this->registerJs($js);
?>













